{extend name="layout" /}
{block name="search"}{/block}
{block name="body"}
<main role="main" class="flex-shrink-0">
  <div class="container py-4">
    
    <div class="row mb-4">
      <div class="col-12 text-center">
        <form name="site-search" method="POST" action="{:url('/search')}">
          <input type="text" name="keywords" value="{$keywords}" placeholder="请输入您要搜索的关键词" class="form-control" />
        </form>
      </div>
    </div>
    <div class="row">
      <div class="col-12">
        <ul class="nav nav-tabs">
          <li class="nav-item">
            <a class="nav-link {if condition='$type_id == 1'}active{/if}" href="{:url('/search/keywords/'.$keywords.'/type_id/1')}">文章</a>
          </li>
          <li class="nav-item">
            <a class="nav-link {if condition='$type_id == 2'}active{/if}" href="{:url('/search/keywords/'.$keywords.'/type_id/2')}">手册</a>
          </li>
        </ul>
        <div class="tab-content">
            {volist name="list" id="vo"}
            <article class="lyear-list-arc">
              <div class="arc-header">
                <h5 class="arc-title"><a href="{:url('/article/'.$vo['id'])}">{$vo.title|raw}</a></h5>
                <ul class="arc-meta">
                  <li><i class="mdi mdi-calendar"></i> <a href="{$vo['column_url']}" target="_blank">{$vo.column_title}</a></li>
                  <li><i class="mdi mdi-calendar"></i> {$vo.create_time}</li>
                  {notempty name="$vo['tags']"}
                  {php}
                  $tags_arr = explode(',', $vo['tags']);
                  $tags_count = count($tags_arr);
                  {/php}
                  <li>
                    <i class="mdi mdi-tag-text-outline"></i> 
                    {volist name="tags_arr" id="tag" key="k"}
                    <a href="/tag/{$tag}">{$tag}</a>{if condition="$tags_count == $k"}{else/},{/if} 
                    {/volist}
                  </li>
                  {/notempty}
                  <li><i class="mdi mdi-eye"></i> {$vo.clicks} 阅读</li>
                </ul>
              </div>
      
              {notempty name="vo['cover']"}
              <div class="arc-preview">
                <img src="{$vo.cover|get_file_path}" alt="{$vo.title}" class="img-fluid rounded" />
              </div>
              {/notempty}
    
              {notempty name="vo['description']"}
              <div class="arc-synopsis">
                <p>{$vo.description|raw}</p>
              </div>
              {/notempty}
            </article>
            {/volist}
      
            <!-- 分页 -->
            <div class="row">
              <div class="col-lg-12">
                {$list|raw}
              </div>
            </div>
            <!-- 分页 end -->
        </div>
      </div>
    </div>
  </div>
</main>
{/block}